

use "data/working/data_ING.dta", clear

* Gender dummy (no missing values)
gen male = (gender == "Man")		
label define genderlabel 0 "0. Gender: Woman" 1 "1. Gender: Man"
label values male genderlabel
label variable male "Gender: male"
				
* Age dummy: <=45 & >45 (no missing values)
gen agenewdummy = (age <= 45)
label define agenewlabel 0 "0. Age: Young" 1 "1. Age: Old"
label values agenewdummy agenewlabel
label variable agenewdummy "Age: Old"
		
* Income dummy: <3k & >=3k ("Prefer not to answer" as poor)
gen incomenewdummy = inlist(hh_netincomeeuro, "3000-3499", "3500-3999", ///
	"4000-4999", "5000-5999", "6000-6999", "7000 or higher")
label define incomenewlabel 0 "0. Income: Poor" 1 "1. Income: Rich"
label values incomenewdummy incomenewlabel
label variable incomenewdummy "Income: Rich"		

split hh_netincomeeuro, parse(-) gen(tmp)
destring tmp1, replace force
destring tmp2, replace
gen income = (tmp1 + tmp2)/2
replace income = 9000 if hh_netincomeeuro=="7000 or higher"
replace income = 0 	if strpos(strlower(hh_netincomeeuro), "any income")>0
sum income, d

* Heard of crypto new dummy (no missing values)
gen heard = (crypto_heardof == "Yes")
label define heard 0 "0. Heard of: No" 1 "1. Heard of: Yes" 
label values heard heard
label variable heard "Heard of: Yes"

* Education (no missing values)
gen edu = inlist(education, "University (Bachelor)", "University (Master, PhD)")
label define edu 0 "0. Edu: Below achelor degree" 1 "1. Edu: Bachelor degree and above" 
label values edu edu
label variable edu "Edu: Bachelor degree and above"

* Expectation ("I don’t have an opinion" as neither)
gen exp = 0 if crypto_future_valueincrease == "Strongly disagree"
replace exp = 1 if crypto_future_valueincrease == "Disagree"
replace exp = 2 if crypto_future_valueincrease == "I don’t have an opinion"
replace exp = 2 if crypto_future_valueincrease == "Neither agree or disagree"
replace exp = 3 if crypto_future_valueincrease == "Agree"
replace exp = 4 if crypto_future_valueincrease == "Strongly agree"

label define exp 0 "0. Increase: Strongly disagree" ///
		1 "1. Increase: Disagree" ///
		2 "2. Increase: I don’t have an opinion" ///
		3 "3. Increase: Agree" ///
		4 "4. Increase: Strongly agree"
label values exp exp
label variable exp "Future_value_increase"


* Employment
gen employ_parttime = employment == "Employed part time"
gen employ_self 	= employment == "Self employed (freelancer, business owner, etc.)"
gen unemploy 		= employment == "Not working due to being unemployed"

gen nonstandardemploy = employment == "Employed part time" | ///
						employment == "Self employed (freelancer, business owner, etc.)" | ///
						employment == "Not working due to being unemployed"

gen exp2 = 0 		if crypto_future_valueincrease == "Strongly disagree" | crypto_future_valueincrease == "Disagree"
replace exp2 = 1 	if crypto_future_valueincrease == "Neither agree or disagree" // | crypto_future_valueincrease == "I don’t have an opinion"
replace exp2 = 2 	if crypto_future_valueincrease == "Agree" | crypto_future_valueincrease == "Strongly agree"


encode Country, gen(Country_id)

replace edu 			= 1-edu
replace incomenewdummy 	= 1-incomenewdummy

* marital status
// gen married = (status == "I am married / in a civil partnership")
egen marital = group(status), label

* household size (4 denotes >=4)
gen hhsize = 1 if hh_size=="1 person"
replace hhsize = 2 if hh_size=="2 people"
replace hhsize = 3 if hh_size=="3 people"
replace hhsize = 4 if hh_size=="4 or more people"

* own
gen own = (crypto_own == "Yes")

* expect own
gen expect_own = (crypto_expectown == "Yes")

egen future_spending = group(crypto_future_spending), label

egen future_investment = group(crypto_future_investment), label

*yearly expectation
gen exp_inc = 	(crypto_future_valueincrease == "Agree" | crypto_future_valueincrease == "Strongly agree") 			if	crypto_future_valueincrease != ""
gen exp_dec = 	(crypto_future_valueincrease == "Strongly disagree" | crypto_future_valueincrease == "Disagree")	if  crypto_future_valueincrease != ""
gen exp_same =  (crypto_future_valueincrease == "Neither agree or disagree") 										if crypto_future_valueincrease != ""

label variable exp_inc "Increase"
label variable exp_dec "Decrease"
label variable exp_same "Same"



*------------------------------------------------------------------------------*
* Save *
*------------------------------------------------------------------------------*

save "data/working/working_ING.dta", replace
